package javacafe.action.factory;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javacafe.action.Action;
import javacafe.action.ActionForward;
import javacafe.dto.bbs.BbsDTO;
import javacafe.paging.PageUtil;
import javacafe.serviceimple.BbsServiceImple;
import javacafe.serviceimple.PagingServiceImple;

public class BeforeBbsMgrAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {
		
		ActionForward actfoward = new ActionForward();
		BbsServiceImple service = BbsServiceImple.getInstance();
		BbsDTO dto = new BbsDTO();
		
		List<BbsDTO> list = null;
		PagingServiceImple pservice = PagingServiceImple.getInstance();
		try {
			PageUtil.pageContollerHelp(pservice, request, 10, 10, "getBbsCountPaging", "getAllBbs", false);
		} catch (ServletException e) {			
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
				
		request.setAttribute("list",list);
		actfoward.setUrl("bbsmgr");
		return actfoward;
	}
}
